//
//  YYTBottomView.m
//  CameraDemo
//
//  Created by apple on 2017/3/9.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "YYTBottomView.h"
#import "Masonry.h"
#define kPad 10
#define kSpace 20
#define SCREEN_WIDTH                    [UIScreen mainScreen].bounds.size.width
#define SCREEN_HEIGHT                   [UIScreen mainScreen].bounds.size.height
#define LabWidth (SCREEN_WIDTH - kPad * 2 - kSpace * 2) / 3.0
@implementation YYTBottomView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self createSubView];
    }
    return self;
}
- (void)createSubView {
    self.angleLab = [[UILabel alloc]init];
    self.angleLab.backgroundColor = [UIColor redColor];
    
    self.zThetaLab = [[UILabel alloc]init];
    self.zThetaLab.backgroundColor = [UIColor redColor];
    self.xyThetaLab = [[UILabel alloc]init];
    self.xyThetaLab.backgroundColor = [UIColor redColor];
    
    self.lab1 = [[UILabel alloc]init];
    self.lab1.backgroundColor = [UIColor redColor];
    self.lab2 = [[UILabel alloc]init];
    self.lab2.backgroundColor = [UIColor redColor];
    self.lab3 = [[UILabel alloc]init];
    self.lab3.backgroundColor = [UIColor redColor];

    [self addSubview:self.angleLab];
    [self addSubview:self.zThetaLab];
    [self addSubview:self.xyThetaLab];
    [self addSubview:self.lab1];
    [self addSubview:self.lab2];
    [self addSubview:self.lab3];
    
    [self.angleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.right.mas_equalTo(0);
        make.height.mas_equalTo(50);
    }];
    [self.zThetaLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.angleLab.mas_bottom).offset(10);
        make.left.mas_equalTo(kPad);
        make.size.mas_equalTo(CGSizeMake((SCREEN_WIDTH - 3 * kPad) * 0.5, 50));
    }];
    [self.xyThetaLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.zThetaLab);
        make.right.mas_equalTo(-kPad);
        make.size.equalTo(self.zThetaLab);
    }];
    [self.lab1 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kSpace);
        make.top.equalTo(self.zThetaLab.mas_bottom).offset(5);
        make.bottom.mas_equalTo(0);
        make.width.mas_equalTo(LabWidth);
    }];
    [self.lab2 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.lab1.mas_right).offset(kPad);
        make.top.bottom.width.equalTo(self.lab1);
    }];
    [self.lab3 mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.lab2.mas_right).offset(kPad);
        make.top.bottom.width.equalTo(self.lab1);
    }];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
